/**
 * @description 全局样式
 */
@import './root.scss';
@import './loading.scss';
@import './normalize.scss';
@import './transition.scss';

@mixin base-scrollbar {
  // &::-webkit-scrollbar {
  //   width: 12px;
  //   height: 12px;
  // }
  // &::-webkit-scrollbar-thumb {
  //   background-color: mix($base-color-white, $base-menu-background, 90%);
  //   border: 3px solid transparent;
  //   border-radius: 2px;
  // }
  // &::-webkit-scrollbar-thumb:hover {
  //   background-color: mix($base-color-white, $base-menu-background, 80%);
  // }
}

.layout-header,
[class*='-bar-container'] {
  transition: var(--vui-transition);

  * {
    transition: var(--vui-transition);
  }
}

html {
  body,
  body[class*='vui-theme-'] {
    position: relative;
    box-sizing: border-box;
    height: 100vh;
    padding: 0;
    overflow: hidden;
    font-family: 'PingFang SC', Arial, 'Microsoft YaHei', sans-serif;
    font-size: $base-font-size-default;
    color: var(--el-color-black);
    background: $base-color-background;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;

    #app {
      height: 100vh;
      @include base-scrollbar;

      .vui-main {
        transition: var(--vui-transition);

        .vui-app-main {
          width: 100%;
          height: 100%;
          padding: 0;
          overflow: hidden;
          transition: var(--vui-transition);

          > section {
            background: var(--el-color-white);
            transition: var(--vui-transition);

            > [class*='-container'] {
              min-height: var(--vui-keep-alive-height);
              padding: 10px;
              background: var(--el-color-white);
              transition: var(--vui-transition);
            }
          }
        }
      }
    }

    * {
      box-sizing: border-box;
      outline: none !important;
      @include base-scrollbar;
    }

    /*a标签 */
    a {
      color: var(--el-color-primary);
      text-decoration: none;
    }

    /*图片 */
    img {
      object-fit: cover;

      &[src=''],
      &:not([src]) {
        opacity: 0;
      }
    }

    /* plus处理图标间距 */
    i + span {
      margin-left: 3px;
    }

    /* vui-fullscreen全屏 */
    .vui-fullscreen {
      position: fixed !important;
      top: 0 !important;
      left: 0 !important;
      z-index: $base-z-index + 3 !important;
      box-sizing: border-box !important;
      width: 100vw !important;
      height: 100vh !important;
      padding-bottom: 15px !important;
      overflow: auto !important;
    }

    /* vui-dropdown下拉动画 */
    .vui-dropdown {
      transition: var(--vui-transition);

      &-active {
        transform: rotateZ(180deg);
      }
    }

    /* vui-dot圆点动画 */
    .vui-dot {
      position: relative;
      display: inline-block;
      width: 6px;
      height: 6px;
      margin-right: 3px;
      vertical-align: middle;
      border-radius: 50%;

      span {
        position: absolute;
        top: 0;
        left: 0;
        box-sizing: border-box;
        display: block;
        width: 100%;
        height: 100%;
        border-radius: 50%;
        animation: vuiDot 1.2s ease-in-out infinite;
        @keyframes vuiDot {
          0% {
            opacity: 0.6;
            transform: scale(0.8);
          }
          to {
            opacity: 0;
            transform: scale(2.4);
          }
        }
      }

      &-success {
        background: var(--el-color-success);

        span {
          background: var(--el-color-success);
        }
      }

      &-error {
        background: var(--el-color-error);

        span {
          background: var(--el-color-error);
        }
      }
    }

    /* vui-data-empty占位图 */
    .vui-data-empty {
      display: flex;
      align-items: center;
      justify-content: center;
    }

    /* el-descriptions */
    .el-descriptions {
      &__title {
        padding-left: 10px;
        border-left: 5px solid var(--el-color-primary);
      }
    }

    /* el-button按钮 */
    .el-button {
      border-radius: 2px;
      padding: 0px 10px;
      min-height: 22px;
      &.is-round {
        border-radius: var(--el-border-radius-round);
      }

      [class*='ri-'] {
        margin-right: 0;
        font-size: 12px;
        vertical-align: -1.8px;
      }

      [class*='el-icon-'] + span {
        margin-left: 3px;
      }
    }

    a + a,
    a + .el-button,
    .el-button + a {
      margin-left: 10px;
    }

    .el-drawer__wrapper {
      outline: none !important;

      * {
        outline: none !important;
      }
    }

    /* v-modal遮罩 */
    .v-modal {
      z-index: $base-z-index;
      background-color: rgba(0, 0, 0, 0.5);
      opacity: 0.6;
      //backdrop-filter: blur(10px);
    }

    /* el-image-viewer遮罩 */
    .el-image-viewer__mask {
      background-color: rgba(0, 0, 0, 0.5);
      opacity: 0.6;
      //backdrop-filter: blur(10px);
    }

    /* el-loading-mask遮罩 */
    .el-loading-mask {
      z-index: $base-z-index - 10 !important;

      &.is-fullscreen {
        z-index: $base-z-index + 99 !important;
      }
    }

    /* el-scrollbar滚动条
    .el-scrollbar {
      height: 100%;

      &__bar {
        z-index: 999;
      }

      &__thumb {
        background-color: mix($base-color-white, $base-menu-background, 90%);

        &:hover {
          background-color: mix($base-color-white, $base-menu-background, 80%);
        }
      }
    }*/

    /* el-form表单 */
    .el-form--label-top {
      .el-form-item__label {
        padding: 0;
      }
    }

    .el-form-item__label {
      padding: 0 10px 0 0;
    }

    .el-range-editor--small {
      .el-range__icon,
      .el-range__close-icon {
        line-height: 23.5px;
      }
    }

    /*  el-badge */
    .el-badge__content {
      border: 0;
    }

    /* el-tag */
    .el-tag {
      border-radius: var(--el-border-radius-base);

      & + .el-tag {
        margin-left: 10px;
      }
    }

    /*  .el-page-header */
    .el-page-header {
      margin: 0 0 var(--vui-margin) 0;
    }

    /* el-alert */
    .el-alert {
      margin: 0 0 var(--vui-margin) 0;

      &--success.is-light {
        color: var(--el-color-success);
        background-color: var(--el-color-success-lighter);
        border: 1px solid var(--el-color-success);

        i {
          color: var(--el-color-success);
        }
      }

      &--info.is-light {
        color: var(--el-color-primary);
        background-color: var(--el-color-primary-light-9);
        border: 1px solid var(--el-color-primary);

        i {
          color: var(--el-color-primary);
        }
      }

      &--warning.is-light {
        color: var(--el-color-warning);
        background-color: var(--el-color-warning-lighter);
        border: 1px solid var(--el-color-warning);

        i {
          color: var(--el-color-warning);
        }
      }

      &--error.is-light {
        color: var(--el-color-error);
        background-color: var(--el-color-error-lighter);
        border: 1px solid var(--el-color-error);

        i {
          color: var(--el-color-error);
        }
      }
    }

    /* el-dropdown-menu */
    .el-dropdown-menu__item {
      [class*='ri-'] {
        margin-right: 0;
      }
    }

    /* markdown编辑器*/
    .editor-toolbar {
      .no-mobile,
      .fa-question-circle {
        display: none;
      }
    }

    /* el-divider间隔线 */
    .el-divider--horizontal {
      margin: 8px 0 13px 0;

      .el-divider__text {
        display: -webkit-box;
        overflow: hidden;
        text-overflow: ellipsis;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
      }
    }

    /* nprogress进度条 */
    #nprogress {
      position: fixed;
      z-index: $base-z-index + 3;

      .bar {
        background: var(--el-color-primary);
      }

      .peg {
        box-shadow: 0 0 10px var(--el-color-primary), 0 0 5px var(--el-color-primary);
      }
    }

    /* el-table表格 */
    .el-table {
      .el-table__body-wrapper {
        // @include base-scrollbar;
      }

      th {
        background: #f5f7fa;
      }

      td,
      th {
        position: relative;
        box-sizing: border-box;

        .cell {
          font-size: $base-font-size-default;
          font-weight: normal;
          color: #606266;

          .el-image {
            width: 50px;
            height: 50px;
            border-radius: $base-border-radius;
          }
        }
      }
    }

    /* el-pagination分页 */
    .el-pagination {
      margin: var(--vui-margin) 0 0 0;
      font-weight: normal;
      color: var(--el-color-black);
      text-align: center;

      i {
        margin: auto !important;
      }
    }

    /* el-menu菜单开始 */
    .el-menu {
      user-select: none;
    }

    /* el-dialog、el-message-box、el-popover */
    @media (max-width: 576px) {
      .el-dialog,
      .el-message-box,
      .el-popover.el-popper {
        width: auto !important;
        margin: 5vw;
      }
    }
    /* el-card卡片 */
    .el-card {
      margin-bottom: var(--vui-margin);
      border-radius: var(--el-border-radius-base);

      &__body {
        padding: var(--vui-padding);
      }
    }

    /* .vui-hey-message */
    .vui-hey-message {
      @mixin vui-hey-message {
        min-width: 246px;
        padding: 15px;
        background-color: var(--el-color-white);
        border-color: var(--el-color-white);
        box-shadow: 0 5px 10px rgba(0, 0, 0, 0.15);

        .el-message__content {
          padding-right: var(--vui-padding);
          color: #34495e;
        }

        .el-icon-close {
          color: #34495e;

          &:hover {
            opacity: 0.8;
          }
        }
      }

      &-info {
        @include vui-hey-message;

        i {
          color: $base-color-grey;
        }
      }

      &-success {
        @include vui-hey-message;

        i {
          color: var(--el-color-success);
        }
      }

      &-warning {
        @include vui-hey-message;

        i {
          color: var(--el-color-warning);
        }
      }

      &-error {
        @include vui-hey-message;

        i {
          color: var(--el-color-error);
        }
      }
    }
  }
}

.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.5s ease;
}

.fade-enter,
.fade-leave-to {
  opacity: 0;
}

.scrollbar--light {
  scrollbar-color: #eaeaea #fafafa;
  scrollbar-width: thin;
}
.scrollbar--light::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}
.scrollbar--light::-webkit-scrollbar-corner {
  background: #d4d4d4;
}
.scrollbar--light::-webkit-scrollbar-thumb {
  background: #eaeaea;
  border: 1px solid #d4d4d4;
}
.scrollbar--light::-webkit-scrollbar-thumb:hover {
  background: #a2a2a2;
}
.scrollbar--light::-webkit-scrollbar-track {
  border: 1px solid #d4d4d4;
  background-color: #fafafa;
}
